package com.fira.cms.service.impl;

import java.util.List;
import com.fira.common.utils.DateUtils;
import com.fira.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fira.cms.mapper.CmsBannerMapper;
import com.fira.cms.domain.CmsBanner;
import com.fira.cms.service.ICmsBannerService;
import com.fira.common.core.text.Convert;

/**
 * banner信息Service业务层处理
 * 
 * @author tony
 * @date 2021-10-09
 */
@Service
public class CmsBannerServiceImpl implements ICmsBannerService 
{
    @Autowired
    private CmsBannerMapper cmsBannerMapper;

    /**
     * 查询banner信息
     * 
     * @param id banner信息ID
     * @return banner信息
     */
    @Override
    public CmsBanner selectCmsBannerById(String id)
    {
        return cmsBannerMapper.selectCmsBannerById(id);
    }

    /**
     * 查询banner信息列表
     * 
     * @param cmsBanner banner信息
     * @return banner信息
     */
    @Override
    public List<CmsBanner> selectCmsBannerList(CmsBanner cmsBanner)
    {
        return cmsBannerMapper.selectCmsBannerList(cmsBanner);
    }

    /**
     * 新增banner信息
     * 
     * @param cmsBanner banner信息
     * @return 结果
     */
    @Override
    public int insertCmsBanner(CmsBanner cmsBanner)
    {
        cmsBanner.setId(IdUtils.fastSimpleUUID());
        cmsBanner.setCreateTime(DateUtils.getNowDate());
        return cmsBannerMapper.insertCmsBanner(cmsBanner);
    }

    /**
     * 修改banner信息
     * 
     * @param cmsBanner banner信息
     * @return 结果
     */
    @Override
    public int updateCmsBanner(CmsBanner cmsBanner)
    {
        cmsBanner.setUpdateTime(DateUtils.getNowDate());
        return cmsBannerMapper.updateCmsBanner(cmsBanner);
    }

    /**
     * 删除banner信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCmsBannerByIds(String ids)
    {
        return cmsBannerMapper.deleteCmsBannerByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除banner信息信息
     * 
     * @param id banner信息ID
     * @return 结果
     */
    @Override
    public int deleteCmsBannerById(String id)
    {
        return cmsBannerMapper.deleteCmsBannerById(id);
    }
}
